home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Oct 15, 1998
- //
- // Description:
- // This script is the create subCharacter option box dialogs.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
-
- proc setOptionVars (int $forceFactorySettings)
- {
- // SubCharacter name
- //
- if ($forceFactorySettings || !`optionVar -exists createSubCharacterName`) {
- optionVar -stringValue createSubCharacterName "subCharacter1";
- }
-
-
- if ($forceFactorySettings || !`optionVar -exists subCharacterKeysToUse`) {
- optionVar -intValue subCharacterKeysToUse 2;
- }
-
- // Which attrs to add to subCharacter
- //
- if ($forceFactorySettings || !`optionVar -exists subCharacterExcTranslate`) {
- // exclude translate
- optionVar -intValue subCharacterExcTranslate 0;
- }
- if ($forceFactorySettings || !`optionVar -exists subCharacterExcRotate`) {
- // exclude rotate
- optionVar -intValue subCharacterExcRotate 0;
- }
- if ($forceFactorySettings || !`optionVar -exists subCharacterExcScale`) {
- // exclude scale
- optionVar -intValue subCharacterExcScale 1;
- }
- if ($forceFactorySettings || !`optionVar -exists subCharacterExcVis`) {
- // exclude visibility
- optionVar -intValue subCharacterExcVis 1;
- }
- if ($forceFactorySettings || !`optionVar -exists subCharacterExcDyn`) {
- // exclude dynamic
- optionVar -intValue subCharacterExcDyn 0;
- }
- }
-
- //
- // Procedure Name:
- // createSubCharacterSetup
- //
- // Description:
- // Update the state of the option box UI to reflect the option values.
- //
- // Input Arguments:
- // parent - Top level parent layout of the option box UI.
- // Required so that UI object names can be
- // successfully resolved.
- //
- // forceFactorySettings - Whether the option values should be set to
- // default values.
- //
- // Return Value:
- // None.
- //
- global proc createSubCharacterSetup (string $parent, int $forceFactorySettings)
- {
- // Retrieve the option settings
- //
- setOptionVars( $forceFactorySettings );
-
- setParent $parent;
-
- // name
- //
- string $name = `optionVar -query createSubCharacterName`;
- textFieldGrp -e -text $name subCharacterNameWidget;
-
- int $exc_t = `optionVar -query subCharacterExcTranslate`;
- checkBoxGrp -edit -value1 $exc_t excludeTranslateWidget;
- int $exc_r = `optionVar -query subCharacterExcRotate`;
- checkBoxGrp -edit -value1 $exc_r excludeRotateWidget;
- int $exc_s = `optionVar -query subCharacterExcScale`;
- checkBoxGrp -edit -value1 $exc_s excludeScaleWidget;
- int $exc_v = `optionVar -query subCharacterExcVis`;
- checkBoxGrp -edit -value1 $exc_v excludeVisWidget;
- int $exc_d = `optionVar -query subCharacterExcDyn`;
- checkBoxGrp -edit -value1 $exc_d excludeDynWidget;
-
- int $exc_total = $exc_t + $exc_r + $exc_s + $exc_v + $exc_d;
-
- int $keysToUse = `optionVar -q subCharacterKeysToUse`;
- if ($keysToUse == 0)
- radioButtonGrp -edit -select 1 subCharacterKeysWidget;
- else if ($keysToUse == 1)
- radioButtonGrp -edit -select 1 charChannelRB;
- else
- radioButtonGrp -edit -select 1 charExceptRB;
-
- if (0 == $exc_total) {
- radioButtonGrp -e -sl 1 subCharacterKeysWidget;
- $keysToUse = 0;
- }
-
- if ($keysToUse != 2) {
- checkBoxGrp -edit -enable 0 excludeTranslateWidget;
- checkBoxGrp -edit -enable 0 excludeRotateWidget;
- checkBoxGrp -edit -enable 0 excludeScaleWidget;
- checkBoxGrp -edit -enable 0 excludeDynWidget;
- checkBoxGrp -edit -enable 0 excludeVisWidget;
- } else {
- checkBoxGrp -edit -enable 1 excludeTranslateWidget;
- checkBoxGrp -edit -enable 1 excludeRotateWidget;
- checkBoxGrp -edit -enable 1 excludeScaleWidget;
- checkBoxGrp -edit -enable 1 excludeDynWidget;
- checkBoxGrp -edit -enable 1 excludeVisWidget;
- }
-
- }
-
- //
- // Procedure Name:
- // createSubCharacterCallback
- //
- // Description:
- // Update the option values with the current state of the option box UI.
- //
- // Input Arguments:
- // parent - Top level parent layout of the option box UI. Required so
- // that UI object names can be successfully resolved.
- //
- // doIt - Whether the command should execute.
- //
- // Return Value:
- // None.
- //
- global proc createSubCharacterCallback (string $parent, int $doIt)
- {
- setParent $parent;
-
- // Name
- //
- optionVar -stringValue createSubCharacterName
- `textFieldGrp -q -text subCharacterNameWidget`;
-
- int $keysToUse = `radioButtonGrp -q -sl subCharacterKeysWidget`;
- int $channel = `radioButtonGrp -q -sl charChannelRB`;
- if ($keysToUse) {
- optionVar -intValue subCharacterKeysToUse 0;
- } else if ($channel) {
- optionVar -intValue subCharacterKeysToUse 1;
- } else {
- optionVar -intValue subCharacterKeysToUse 2;
- }
-
- // which attrs to exclude in the subCharacter
- //
- optionVar -intValue subCharacterExcTranslate
- `checkBoxGrp -q -value1 excludeTranslateWidget`;
- optionVar -intValue subCharacterExcRotate
- `checkBoxGrp -q -value1 excludeRotateWidget`;
- optionVar -intValue subCharacterExcScale
- `checkBoxGrp -q -value1 excludeScaleWidget`;
- optionVar -intValue subCharacterExcVis
- `checkBoxGrp -q -value1 excludeVisWidget`;
- optionVar -intValue subCharacterExcDyn
- `checkBoxGrp -q -value1 excludeDynWidget`;
-
- if ($doIt)
- {
- performCreateSubcharacter false;
- addToRecentCommandQueue "performCreateSubcharacter false" "CreateSubCharacter";
- }
- }
-
- global proc subcharAllKeyableOnCB()
- {
- checkBoxGrp -edit -enable 0 excludeTranslateWidget;
- checkBoxGrp -edit -enable 0 excludeRotateWidget;
- checkBoxGrp -edit -enable 0 excludeScaleWidget;
- checkBoxGrp -edit -enable 0 excludeVisWidget;
- checkBoxGrp -edit -enable 0 excludeDynWidget;
- }
-
- global proc subcharAllKeyableOffCB()
- {
- checkBoxGrp -edit -enable 1 excludeTranslateWidget;
- checkBoxGrp -edit -enable 1 excludeRotateWidget;
- checkBoxGrp -edit -enable 1 excludeScaleWidget;
- checkBoxGrp -edit -enable 1 excludeVisWidget;
- checkBoxGrp -edit -enable 1 excludeDynWidget;
- }
-
- global proc updateSubCharWidgetsCB()
- {
- int $exc_t = `checkBoxGrp -q -value1 excludeTranslateWidget`;
- int $exc_r = `checkBoxGrp -q -value1 excludeRotateWidget`;
- int $exc_s = `checkBoxGrp -q -value1 excludeScaleWidget`;
- int $exc_v = `checkBoxGrp -q -value1 excludeVisWidget`;
- int $exc_d = `checkBoxGrp -q -value1 excludeDynWidget`;
- int $exc_total = $exc_t + $exc_r + $exc_s + $exc_v + $exc_d;
-
- if (0 == $exc_total) {
- radioButtonGrp -e -sl 1 subCharacterKeysWidget;
- }
- }
-
-
- proc string createSubCharacterWidgets( string $parent )
- {
- setParent $parent;
-
- string $tabForm = `columnLayout -adjustableColumn true`;
-
- textFieldGrp -label "Name" -text "subCharacter1" subCharacterNameWidget;
-
- radioButtonGrp -numberOfRadioButtons 1
- -label "Subcharacter Set Attributes"
- -label1 "All Keyable"
- -onc subcharAllKeyableOnCB
- subCharacterKeysWidget;
-
- radioButtonGrp -numberOfRadioButtons 1
- -label1 "From Channel Box"
- -shareCollection subCharacterKeysWidget
- -onc subcharAllKeyableOnCB
- charChannelRB;
-
- radioButtonGrp -numberOfRadioButtons 1
- -label1 "All Keyable Except:"
- -shareCollection subCharacterKeysWidget
- -onc subcharAllKeyableOffCB
- charExceptRB;
-
- // which attributes to exclude in subCharacter
- checkBoxGrp
- -label ""
- -label1 "No Translate"
- -numberOfCheckBoxes 1
- -ofc updateSubCharWidgetsCB
- excludeTranslateWidget;
- checkBoxGrp
- -label ""
- -label1 "No Rotate"
- -numberOfCheckBoxes 1
- -ofc updateSubCharWidgetsCB
- excludeRotateWidget;
- checkBoxGrp
- -label ""
- -label1 "No Scale"
- -numberOfCheckBoxes 1
- -ofc updateSubCharWidgetsCB
- excludeScaleWidget;
- checkBoxGrp
- -label ""
- -label1 "No Visibility"
- -numberOfCheckBoxes 1
- -ofc updateSubCharWidgetsCB
- excludeVisWidget;
- checkBoxGrp
- -label ""
- -label1 "No Dynamic"
- -numberOfCheckBoxes 1
- -ofc updateSubCharWidgetsCB
- excludeDynWidget;
-
- return $tabForm;
- }
-
- global proc createSubCharacterOptions ()
- {
- string $commandName = "createSubCharacter";
-
- string $applyTitle = "Create";
-
- // Build the option box "methods"
- //
- string $callback = ($commandName + "Callback");
- string $setup = ($commandName + "Setup");
-
- // Get the option box.
- //
- // The value returned is the name of the layout to be used as
- // the parent for the option box UI.
- //
- string $layout = getOptionBox();
- setParent $layout;
-
- setOptionBoxCommandName("character");
-
- setUITemplate -pushTemplate DefaultTemplate;
- waitCursor -state 1;
- tabLayout -scr true -tv false; // To get the scroll bars
-
- string $parent = `columnLayout -adjustableColumn 1`;
-
- createSubCharacterWidgets $parent;
-
- waitCursor -state 0;
- setUITemplate -popTemplate;
-
- // 'Apply' button.
- //
- string $applyBtn = getOptionBoxApplyBtn();
- button -edit
- -label "Create Subcharacter Set"
- -command ($callback + " " + $parent + " " + 1)
- $applyBtn;
-
- // 'Save' button.
- //
- string $saveBtn = getOptionBoxSaveBtn();
- button -edit
- -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
- $saveBtn;
-
- // 'Reset' button.
- //
- string $resetBtn = getOptionBoxResetBtn();
- button -edit
- -command ($setup + " " + $parent + " " + 1)
- $resetBtn;
-
- // Set the option box title.
- //
- setOptionBoxTitle("Create Subcharacter Set Options");
-
- // Customize the 'Help' menu item text.
- //
- setOptionBoxHelpTag( "CreateSubcharacter" );
-
- // Set the current values of the option box.
- //
- eval (($setup + " " + $parent + " " + 0));
-
- // Show the option box.
- //
- showOptionBox();
- }
-
-
- //
- // Procedure Name:
- // assembleCmd
- //
- // Description:
- // Construct the command that will apply the option box values.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- proc string assembleCmd()
- {
- string $cmd;
-
- setOptionVars(false);
-
- // get the partition name
- string $subCharacterName = "subCharacter1";
- if (`optionVar -exists createSubCharacterName`) {
- $subCharacterName = `optionVar -query createSubCharacterName`;
- }
-
- int $excludeTranslate = 0;
- int $excludeRotate = 0;
- int $excludeScale = 0;
- int $excludeVisibility = 0;
- int $excludeDynamic = 0;
- int $useChannelBox = 0;
-
- if (`optionVar -exists subCharacterKeysToUse`) {
- int $keysToUse = `optionVar -q subCharacterKeysToUse`;
- if ($keysToUse == 2) {
- if (`optionVar -exists subCharacterExcTranslate`) {
- $excludeTranslate = (`optionVar -query subCharacterExcTranslate`);
- }
- if (`optionVar -exists subCharacterExcRotate`) {
- $excludeRotate = (`optionVar -query subCharacterExcRotate`);
- }
- if (`optionVar -exists subCharacterExcScale`) {
- $excludeScale = (`optionVar -query subCharacterExcScale`);
- }
- if (`optionVar -exists subCharacterExcVis`) {
- $excludeVisibility = (`optionVar -query subCharacterExcVis`);
- }
- if (`optionVar -exists subCharacterExcDyn`) {
- $excludeDynamic = (`optionVar -query subCharacterExcDyn`);
- }
- } else if ($keysToUse == 1) {
- $useChannelBox = 1;
- }
- }
-
- // doCreateSubCharacterArgList takes a string array
- //
- $cmd = "doCreateSubcharacterArgList 2 { " +
- "\"" + $subCharacterName + "\"" +
- ",\"" + $excludeTranslate + "\"" +
- ",\"" + $excludeRotate + "\"" +
- ",\"" + $excludeScale + "\"" +
- ",\"" + $excludeVisibility + "\"" +
- ",\"" + $excludeDynamic + "\"" +
- ",\"" + $useChannelBox + "\"" +
- " };";
-
- return $cmd;
- }
-
- //
- // Procedure Name:
- // performCreateSubcharacter
- //
- // Description:
- // Create a subCharacter and add the animatable attributes from the
- // selected nodes. This procedure will also show the option box
- // window if necessary as well as construct the command string
- // that will create a subCharacter with the current option box values.
- //
- // Input Arguments:
- // 0 - Execute the command.
- // 1 - Show the option box dialog.
- // 2 - Return the command.
- //
- // Return Value:
- // None.
- //
- global proc string
- performCreateSubcharacter (int $action)
- {
- string $cmd = "";
-
- switch ($action) {
-
- // Execute the command.
- //
- case 0:
- // Retrieve the option settings
- //
- setOptionVars(false);
-
- // Get the command.
- //
- $cmd = `assembleCmd`;
-
- // Execute the command with the option settings.
- //
- evalEcho($cmd);
-
- break;
-
- // Show the option box.
- //
- case 1:
- createSubCharacterOptions;
- break;
- case 2:
- // Get the command.
- //
- $cmd = `assembleCmd`;
- }
- return $cmd;
- }
-
-